<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title/>
<script>
<![CDATA[
function test() {

  if (window.testRunner)
    testRunner.dumpAsText();

  try {
    serialized = (new XMLSerializer()).serializeToString(document.getElementById("testDiv\"'&<>"));
    if (serialized == "<div xmlns=\"http://www.w3.org/1999/xhtml\" id=\"testDiv&quot;'&amp;&lt;&gt;\"/>" ||
        serialized == "<div xmlns=\"http://www.w3.org/1999/xhtml\" id=\"testDiv&quot;'&amp;&lt;&gt;\"></div>" ||
        serialized == "<div xmlns=\"http://www.w3.org/1999/xhtml\" id=\"testDiv&quot;'&amp;&lt;>\"/>" ||
        serialized == "<div xmlns=\"http://www.w3.org/1999/xhtml\" id=\"testDiv&quot;'&amp;&lt;>\"></div>")
      document.getElementById("result").textContent = "SUCCESS";
    else
      document.getElementById("result").textContent = "FAIL: " + (new XMLSerializer()).serializeToString(document.getElementsByTagName('div')[1]);
  } catch (ex) {
    alert(ex);
  }
}
]]>
</script>
</head>
<body onload="test();">
<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=11998">bug 11998</a>:
Incorrect serialization of quotation marks in XML attributes.</p>
<div id="result">FAIL: cannot find an element.</div>

<!-- Currently, WebKit doesn't serialize the namespace unless it's explicitly specified, bug 5262 -->
<div xmlns="http://www.w3.org/1999/xhtml" id="testDiv&#34;&#39;&#38;&#60;&#62;"/>
</body>
</html>
